<template>
  <div>
    <h2>子组件</h2>
    <p>收到💴:{{money}}</p>
    <p><button @click="change">改</button></p>
    <GrandSon/>
  </div>
</template>

<script>
import GrandSon from '@/views/组件通信/grand-son.vue/'
export default {
  components:{
    GrandSon
  },
  props:{
      money:{
      type:Number,
      default:0
    }
  },
  setup(props,{emit}){
    console.log('vue3',props,props.money)
    const change = ()=> {
      // emit() === this.$emit  =>  子传父
      emit('change-money',1e7)
    }
    
    return {change}
  },
  created(){
    console.log('vue2',this.money,this.$emit)
  }
}
</script>

<style>

</style>